package com.spring.mybatis.anno.dao;


import java.util.List;

import com.spring.mybatis.anno.po.User;
import org.apache.ibatis.annotations.*;


public interface UserDao {

  @Select("select * from t_user where id=#{id}")
  User selectById(String id);

  @Select("select * from t_user")
  List<User> selectAll();

  @Select("select * from t_user where username=#{username}")
  User selectByUserName(String username);

  @Insert("insert into t_user (id,username,password) values(#{id},#{username},#{password})")
  @Options(useGeneratedKeys=true,keyColumn="id")  //获取自增的id
  void insert(User user);

  @Update("update t_user set password = #{password} where id=#{id}")
  int update(User user);

  @Delete(" delete from t_user where id=#{id}")
  int deleteById(String id);
}
